Agent Heartbeat
Agents
Agent Heartbeat
Record agent liveness or auto-create agent on first heartbeat
POST
Agent Heartbeat
Updates the agent’s
This endpoint requires an empty JSON body
last_seen_at timestamp to indicate liveness. If the agent doesn’t exist, it will be automatically created and provisioned.
Authentication
Requires agent authentication viaX-Agent-Token header (not Authorization header).
The agent token is provided in the TOOLS.md file in the agent’s workspace.
Heartbeat Mechanisms
Mission Control supports two heartbeat endpoints:- POST /api/v1/agents/heartbeat - Auto-creates agent if it doesn’t exist (this endpoint)
- POST /api/v1/agents//heartbeat - Updates existing agent only
- POST /api/v1/agent/heartbeat - Agent-scoped heartbeat (uses token to identify agent)
Request Body
Display name for the agent (used during bootstrap/creation)
Board context for bootstrap (if creating agent)
Agent health status:
healthy, offline, degradedResponse
Returns anAgentRead object with the same structure as List Agents.
Heartbeat Workflow
Existing Agent
If the agent already exists:- Updates
last_seen_atto current timestamp - Optionally updates
statusif provided - Returns current agent state
New Agent (Bootstrap)
If the agent doesn’t exist:- Creates new agent record with provided
nameandboard_id - Provisions agent on the gateway (same as Provision Agent)
- Generates workspace and configuration files
- Returns newly created agent
Example Request (Existing Agent)
Example Request (New Agent)
Example Response
Recommended Heartbeat Frequency
Agents should send heartbeats at regular intervals:- Default: Every 60 seconds
- Configurable: Via
heartbeat_config.interval_secondsin agent record - Tolerance: Set via
heartbeat_config.missing_tolerance(default: 120 seconds)
last_seen_at is older than current_time - missing_tolerance.
Agent-Scoped Heartbeat
For agents that know their own ID, use the agent-scoped endpoint:{} or no body.
Error Responses
401 Unauthorized
Invalid or missing X-Agent-Token header
403 Forbidden
Agent token is valid but agent lacks permission
422 Unprocessable Entity
Validation failed (e.g., name is required for bootstrap)
Use Cases
- Liveness Monitoring: Periodic heartbeats to track online/offline status
- Auto-Provisioning: First heartbeat from a new agent triggers provisioning
- Health Status: Report degraded state during recovery or high load
- Monitoring Dashboard: Display agent health based on
last_seen_at
Best Practices
- Retry Logic: Implement exponential backoff for failed heartbeats
- Batch Updates: Don’t send heartbeats more frequently than configured interval
- Status Reporting: Use
statusfield to report degraded states - Error Handling: Log heartbeat failures for debugging